package com.amigo.online.provider.user.rocketmq.consumer;

import java.util.Arrays;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.amigo.online.provider.user.rocketmq.PushMessage;
import com.amigo.online.provider.user.rocketmq.model.BaseMqSendModel;
import com.amigo.online.provider.user.service.UserService;

@Component("UpdateLocation")
public class UpdateLocationConsumer implements PushMessage {

    @Autowired
    UserService userService;

    @Override
    public void handleMessage(BaseMqSendModel baseMqSendModel) {
        //location 格式 lat,lng,userId
        String location[] = ((String) baseMqSendModel.getSendContentBean()).split(",");
        userService.updateUserPoint(Arrays.asList(Double.valueOf(location[1]),
                Double.valueOf(location[0])), Long.valueOf(location[2]));
    }

}
